#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll factorial(int n){
	ll s=1;
	for(int i=2;i<=n;i++){
		s*=i;
	}
	return s;
}
int main() {
	int n;
	cin>>n;
	ll sum=0;
	for(int i=1;i<=n;i++){
		sum+=factorial(i);
	}
	cout<<sum;
	return 0;
}
